<?php
	
	// Session
	session_start();
	
	
	// Nese leximi i faqes behet nga ndonje burim ekstern duke mos e definuar identifikatorin e librit
	if (!isset($_GET['id'])) {
		header("Location: ../comunity/index.php?spalsh=wrong");
		exit;
	}
	
	
	// Integrimi i skedave sistemore
    include('../include/functions.inc.php');
	include('../include/template.class.php');
	include('../include/book.class.php');
	
	
	// PROJECT
	$PROJECT = setProject();
	
	
	// Ndyshoret primare
	define('TPL','../include/styles/'.$PROJECT['style'].'/comunity/content.html');
	define('FILENAME',basename($_SERVER["PHP_SELF"]));
	define('UID',$_SESSION['user_id']);
	define('ID',$_GET['id']);
	define('PART',$_GET['part']);
	
	
	// DB CONNECT
	dbOpen("comunity");	
	
	
	// TMP CLASS
	$tmp = new Template(TPL,$PROJECT['lang']);
	
	
	// BOOK CLASS
	$book = new Book(ID);
	$book->setBook();
	$book->setContent(PART);
	$book->BOOK['content'] = $book->displayPart();
	
	
	// MENUES
	$getBook = "?id=".ID;
	$tmp->setContent("CATEGORY",$tmp->menu("category","../comunity"));
	$tmp->setContent("BOOKMENU",$tmp->menu("book",FILENAME,$getBook));
	$tmp->setContent("SECTIONS",sections($book->BOOK['sid']));
	$tmp->setContent("FOOTMENU",$tmp->menu("foot"));
	

	// ACCORDIONS
	$tmp->setContent("INFOBOOK",$book->BOOK);
	$tmp->setContent("BOOKTREE",$book->BOOKTREE);
	$tmp->setContent("FROMAUTHOR",$book->fromAuthor());
	$tmp->setContent("READMORE",$book->readMore());
	$tmp->setContent("NEWS",news("comunity"));
	$tmp->setContent("RANDOM",randomContent("comunity"));
	
	
	// BOOK VARS
	$tmp->setContent($book->BOOK);

	
	// LABELS
	$tmp->setLabels();

	
	// DISPLAY ALL						  
	echo $tmp->vorlage;
?>